#include <asm.h>
#include <regdef.h>
#include <inst_test.h>

LEAF(n66_sh_test)
    .set noreorder
    addiu s0, s0, 1
    li  s2, 0x0
###test inst
    TEST_SH(0xe15f8848, 0x0e1a3600, 0x800d52a4, 0x00003ade, 0x00003adc, 0x36008848)
    TEST_SH(0x04105cf0, 0xb64d5300, 0x800d3f6c, 0x0000156a, 0x00001568, 0x53005cf0)
    TEST_SH(0xd187bd18, 0xa1cf708e, 0x800db7a0, 0x00000bf4, 0x00000bf4, 0xd187708e)
    TEST_SH(0xb5abcbf4, 0xee02bbc2, 0x800d6188, 0x00002e44, 0x00002e44, 0xb5abbbc2)
    TEST_SH(0x6b04bf60, 0x306960f0, 0x800d8d40, 0x00006580, 0x00006580, 0x6b0460f0)
    TEST_SH(0x2532d240, 0xfe00ebf6, 0x800d7090, 0x00002086, 0x00002084, 0xebf6d240)
    TEST_SH(0x2b61ec90, 0x28bde000, 0x800d24e0, 0x000024d6, 0x000024d4, 0xe000ec90)
    TEST_SH(0xa52de360, 0xf5699820, 0x800d3b4c, 0x00005e50, 0x00005e50, 0xa52d9820)
    TEST_SH(0x7978aff8, 0xa69f3ca0, 0x800d2968, 0x00005364, 0x00005364, 0x79783ca0)
    TEST_SH(0xc4ddc7df, 0x0a66bf0c, 0x800dad70, 0x000002bc, 0x000002bc, 0xc4ddbf0c)
    TEST_SH(0xd6ef145e, 0x27d4869c, 0x800d1500, 0x000048b6, 0x000048b4, 0x869c145e)
    TEST_SH(0xe57c6800, 0xa1fc6927, 0x800d2f30, 0x0000693c, 0x0000693c, 0xe57c6927)
    TEST_SH(0xa6450915, 0x4c8fb6e6, 0x800d2728, 0x000022b8, 0x000022b8, 0xa645b6e6)
    TEST_SH(0x39378cfc, 0xec7b2b18, 0x800de270, 0x000005f4, 0x000005f4, 0x39372b18)
    TEST_SH(0x4171b083, 0x58c1d2c8, 0x800d3098, 0x0000004c, 0x0000004c, 0x4171d2c8)
    TEST_SH(0x761656b0, 0x02f53f68, 0x800d3c40, 0x000085dc, 0x000085dc, 0x76163f68)
    TEST_SH(0xe249ae52, 0x8d75b188, 0x800d0a20, 0x0000d0da, 0x0000d0d8, 0xb188ae52)
    TEST_SH(0xaa8273e0, 0x4ad44d00, 0x800d9cf0, 0x00003ecc, 0x00003ecc, 0xaa824d00)
    TEST_SH(0x98dd412e, 0xc3e1f538, 0x800d33d4, 0x00006888, 0x00006888, 0x98ddf538)
    TEST_SH(0xf7051708, 0x2612cae7, 0x800d910c, 0x0000658a, 0x00006588, 0xcae71708)
    TEST_SH(0xf649b700, 0xd674f530, 0x800d43f4, 0x00007ae0, 0x00007ae0, 0xf649f530)
    TEST_SH(0x00804f26, 0x23b1f91c, 0x800d2b58, 0x0000c826, 0x0000c824, 0xf91c4f26)
    TEST_SH(0x82ca8844, 0xb7b6d134, 0x800d065c, 0x00001508, 0x00001508, 0x82cad134)
    TEST_SH(0x74b56c00, 0xc1250920, 0x800d4370, 0x00008a92, 0x00008a90, 0x09206c00)
    TEST_SH(0xb99fef40, 0xd5377a44, 0x800d0144, 0x0000c640, 0x0000c640, 0xb99f7a44)
    TEST_SH(0xbf9b8ef0, 0x868b1930, 0x800d5920, 0x00003fd6, 0x00003fd4, 0x19308ef0)
    TEST_SH(0x7da1adef, 0x7d7008a0, 0x800d2020, 0x00004cc0, 0x00004cc0, 0x7da108a0)
    TEST_SH(0xf23347d4, 0x214070c6, 0x800d0b58, 0x0000c83c, 0x0000c83c, 0xf23370c6)
    TEST_SH(0xb54f5ca2, 0x893735c8, 0x800d23a4, 0x00005048, 0x00005048, 0xb54f35c8)
    TEST_SH(0xf82969ad, 0x0121c94c, 0x800d24b8, 0x00002ad0, 0x00002ad0, 0xf829c94c)
    TEST_SH(0xeca96c00, 0x50bc9348, 0x800d1584, 0x00004ca8, 0x00004ca8, 0xeca99348)
    TEST_SH(0xb731e211, 0x097e93b8, 0x800d1a8c, 0x0000514c, 0x0000514c, 0xb73193b8)
    TEST_SH(0xe4e42ad0, 0x5f45347c, 0x800d54d8, 0x00004284, 0x00004284, 0xe4e4347c)
    TEST_SH(0x4aa5c058, 0x5e83e8d0, 0x800d28c0, 0x0000b0ca, 0x0000b0c8, 0xe8d0c058)
    TEST_SH(0x10546b60, 0x949220de, 0x800deb88, 0x00001084, 0x00001084, 0x105420de)
    TEST_SH(0x54c87bb0, 0xac9f1540, 0x800d8964, 0x00003c7e, 0x00003c7c, 0x15407bb0)
    TEST_SH(0x20612be0, 0x76231aa0, 0x800da4a4, 0x0000311a, 0x00003118, 0x1aa02be0)
    TEST_SH(0x23938928, 0x5976c160, 0x800dc7c8, 0x000000d2, 0x000000d0, 0xc1608928)
    TEST_SH(0x042a28c0, 0xf84b893f, 0x800d12f8, 0x000031ee, 0x000031ec, 0x893f28c0)
    TEST_SH(0x4b509c68, 0x0630b104, 0x800d4f80, 0x0000adbc, 0x0000adbc, 0x4b50b104)
    TEST_SH(0x7ea74858, 0x8943216c, 0x800d0000, 0x000084f0, 0x000084f0, 0x7ea7216c)
    TEST_SH(0xfd4dfbaa, 0xfc370cd0, 0x800d0000, 0x00005b62, 0x00005b60, 0x0cd0fbaa)
    TEST_SH(0xef7b46c8, 0xba1d06fc, 0x800d0000, 0x00005848, 0x00005848, 0xef7b06fc)
    TEST_SH(0x151b86df, 0x95faec5f, 0x800d0000, 0x000002c0, 0x000002c0, 0x151bec5f)
    TEST_SH(0x12664cbb, 0x68ff7500, 0x800d0000, 0x000051ec, 0x000051ec, 0x12667500)
    TEST_SH(0x738376f0, 0x7abdfe92, 0x800d0000, 0x0000010c, 0x0000010c, 0x7383fe92)
    TEST_SH(0xa81859c0, 0xeedf1820, 0x800d0000, 0x0000bedc, 0x0000bedc, 0xa8181820)
    TEST_SH(0xbf9625c0, 0xb7751ea0, 0x800d0000, 0x0000c894, 0x0000c894, 0xbf961ea0)
    TEST_SH(0x8a0b0e78, 0xaea10357, 0x800d0000, 0x0000e5e8, 0x0000e5e8, 0x8a0b0357)
    TEST_SH(0x38c0feb0, 0x2552c584, 0x800d0000, 0x00009968, 0x00009968, 0x38c0c584)
    TEST_SH(0x09de6ee8, 0xe4279110, 0x800d0000, 0x0000a6a0, 0x0000a6a0, 0x09de9110)
    TEST_SH(0xffeb3340, 0x8950f9f6, 0x800d0000, 0x00003408, 0x00003408, 0xffebf9f6)
    TEST_SH(0x8f7024be, 0x5c89cd7a, 0x800d0000, 0x00008c00, 0x00008c00, 0x8f70cd7a)
    TEST_SH(0xeb292500, 0xac476c50, 0x800d0000, 0x0000ad4a, 0x0000ad48, 0x6c502500)
    TEST_SH(0xf85d3b84, 0xd58d7eb8, 0x800d0000, 0x00003c38, 0x00003c38, 0xf85d7eb8)
    TEST_SH(0x2b1420e8, 0xb0618d2c, 0x800d0000, 0x00004b18, 0x00004b18, 0x2b148d2c)
    TEST_SH(0x9e687728, 0x1e59b179, 0x800d0000, 0x00003880, 0x00003880, 0x9e68b179)
    TEST_SH(0x2611a63a, 0x1b8eeb80, 0x800d0000, 0x00008d72, 0x00008d70, 0xeb80a63a)
    TEST_SH(0x1ccb4da8, 0xe8972ef0, 0x800d0000, 0x0000ed84, 0x0000ed84, 0x1ccb2ef0)
    TEST_SH(0x720c51f4, 0x1c42a1e0, 0x800d0000, 0x0000ed86, 0x0000ed84, 0xa1e051f4)
    TEST_SH(0xdd72d0b0, 0xa1154920, 0x800d0000, 0x0000e740, 0x0000e740, 0xdd724920)
    TEST_SH(0x8882040c, 0xf8e07e80, 0x800d0000, 0x000013d8, 0x000013d8, 0x88827e80)
    TEST_SH(0xf85484f0, 0x2056abbc, 0x800d0000, 0x0000c03a, 0x0000c038, 0xabbc84f0)
    TEST_SH(0x5eb19438, 0x3ec88830, 0x800d0000, 0x0000f612, 0x0000f610, 0x88309438)
    TEST_SH(0x4c34a5a0, 0x41f8c4b0, 0x800d0000, 0x0000f1e6, 0x0000f1e4, 0xc4b0a5a0)
    TEST_SH(0x9bc00fe8, 0x19fbb8d6, 0x800d0000, 0x00000ace, 0x00000acc, 0xb8d60fe8)
    TEST_SH(0xe293a67e, 0xcc730080, 0x800d0000, 0x000051b0, 0x000051b0, 0xe2930080)
    TEST_SH(0x93c7d5b0, 0xc0c99855, 0x800d0000, 0x0000b540, 0x0000b540, 0x93c79855)
    TEST_SH(0x5a4a07f6, 0x04219ef4, 0x800d0000, 0x000048b2, 0x000048b0, 0x9ef407f6)
    TEST_SH(0x0cb809e4, 0x8cfcf2c0, 0x800d0000, 0x00005e60, 0x00005e60, 0x0cb8f2c0)
    TEST_SH(0xb596ca6a, 0x8df9423c, 0x800d0000, 0x0000be9e, 0x0000be9c, 0x423cca6a)
    TEST_SH(0xa84a74a8, 0x4cc9d636, 0x800d0000, 0x0000aecc, 0x0000aecc, 0xa84ad636)
    TEST_SH(0xaa5e6ea0, 0xa81b9980, 0x800d0000, 0x00002cc8, 0x00002cc8, 0xaa5e9980)
    TEST_SH(0xb266af70, 0xad2f8b20, 0x800d0000, 0x0000ad0a, 0x0000ad08, 0x8b20af70)
    TEST_SH(0x40d3b176, 0xe4311540, 0x800d0000, 0x00004ff0, 0x00004ff0, 0x40d31540)
    TEST_SH(0x80b37e6c, 0x55d5b870, 0x800d0000, 0x00009400, 0x00009400, 0x80b3b870)
    TEST_SH(0xed5258d8, 0x9fdd23a8, 0x800d0000, 0x0000fbe0, 0x0000fbe0, 0xed5223a8)
    TEST_SH(0x3974b6f0, 0x48a01f4e, 0x800d0000, 0x0000ae00, 0x0000ae00, 0x39741f4e)
    TEST_SH(0x77ddf4e0, 0xe28aeb00, 0x800d0000, 0x00001700, 0x00001700, 0x77ddeb00)
    TEST_SH(0x1865dd7c, 0xa83f8680, 0x800d0000, 0x00000000, 0x00000000, 0x18658680)
    TEST_SH(0x3dc131bc, 0x051e07d1, 0x800d0000, 0x00000002, 0x00000000, 0x07d131bc)
    TEST_SH(0x58e132b2, 0x3baa3c68, 0x800d0000, 0x00000000, 0x00000000, 0x58e13c68)
    TEST_SH(0x498cc104, 0x0c5552e2, 0x800d0000, 0x00000000, 0x00000000, 0x498c52e2)
    TEST_SH(0x906fc250, 0xd942b23c, 0x800d0000, 0x00000000, 0x00000000, 0x906fb23c)
    TEST_SH(0x110ed930, 0xc2876832, 0x800d0000, 0x00000002, 0x00000000, 0x6832d930)
    TEST_SH(0xc39096a4, 0xa568a9e0, 0x800d0000, 0x00000000, 0x00000000, 0xc390a9e0)
    TEST_SH(0xfe0434c1, 0xe286dc78, 0x800d0000, 0x00000000, 0x00000000, 0xfe04dc78)
    TEST_SH(0x4345056c, 0x6e34bc70, 0x800d0000, 0x00000000, 0x00000000, 0x4345bc70)
    TEST_SH(0x3d489f5f, 0xfe2dc400, 0x800d0000, 0x00000002, 0x00000000, 0xc4009f5f)
    TEST_SH(0x46e60202, 0xd456f5e0, 0x800d0000, 0x00000002, 0x00000000, 0xf5e00202)
    TEST_SH(0x3d44363a, 0x1013b676, 0x800d0000, 0x00000000, 0x00000000, 0x3d44b676)
    TEST_SH(0x81080000, 0x30c06a40, 0x800d0000, 0x00000000, 0x00000000, 0x81086a40)
    TEST_SH(0x7e386f48, 0x6dfddc50, 0x800d0000, 0x00000002, 0x00000000, 0xdc506f48)
    TEST_SH(0xdd5fcc66, 0x8f70aaa6, 0x800d0000, 0x00000002, 0x00000000, 0xaaa6cc66)
    TEST_SH(0xf5d0cd30, 0x8fb81998, 0x800d0000, 0x00000002, 0x00000000, 0x1998cd30)
    TEST_SH(0x19d5e812, 0x25ed5b7f, 0x800d0000, 0x00000002, 0x00000000, 0x5b7fe812)
    TEST_SH(0x4b179300, 0xa5a0ecb4, 0x800d0000, 0x00000000, 0x00000000, 0x4b17ecb4)
    TEST_SH(0xe00dfa00, 0x78d7370c, 0x800d0000, 0x00000002, 0x00000000, 0x370cfa00)
    TEST_SH(0xb704fce8, 0x52ecd998, 0x800d0000, 0x00000002, 0x00000000, 0xd998fce8)
    TEST_SH(0x02075c00, 0x3cabc304, 0x800d0000, 0x00000000, 0x00000000, 0x0207c304)
    TEST_SH(0x896c92c0, 0xf81c4fea, 0x800d0000, 0x00000000, 0x00000000, 0x896c4fea)
    TEST_SH(0xabc03313, 0x68403610, 0x800d0000, 0x00000002, 0x00000000, 0x36103313)
    TEST_SH(0x00000000, 0x00000000, 0x800d0000, 0x00000000, 0x00000000, 0x00000000)
###detect exception
    bne s2, zero, inst_error
    nop
###score ++
    addiu s3, s3, 1
###output (s0<<24)|s3
inst_error:  
    sll t1, s0, 24
    or t0, t1, s3 
    sw t0, 0(s1)
    jr ra
    nop
END(n66_sh_test)
